<?php

namespace App\Repositories\Mgt;

use Prettus\Repository\Eloquent\BaseRepository as Repository;

class BranchRepository extends Repository
{

    /**
     * 指定模型名称
     *
     * @return mixed
     */
    public function model()
    {
        return 'App\Models\Mgt\Branch';
    }

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index($query = '')
    {
        // 获取分页数据
        if (!$query) {
            $result = $this->model
                ->orderBy('order', 'asc')
                ->get();
        } else {
            // 若有查询参数
            $result = $this->model
                ->where('name', 'like', "%$query%")
                ->get();
        }

        return $result;
    }


    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }



    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
}
